In many applications, devices with memories are used in order to store a value of a counter for a certain amount of time. For example, a wireless car key with an RF transmitter has an internal memory. Every time the key is used, an internal counter in the key is incremented. The internal count in the key is encrypted and the encrypted count is sent to the car for being compared with a corresponding count generated and stored in a memory in the car. The counts stored in the key and in the car are compared every time the key is used. If the counts are not within a certain range, the car cannot be opened with the key anymore and a synchronization has to be performed. This provides additional safety against copying of wireless car keys. A major problem lies in the limited write cycles of the memory in the key. Typically, EEPROMs are used as they are non-volatile, but they withstand only several thousands up to several hundreds of thousands of write cycles. When the maximum number of write cycles is reached, the device using the memory, i.e. e.g. the wireless car key ceases functioning properly. In order to avoid premature failure of the key, the memory in the key is typically redundant, i.e. there is more memory than required by the mere bit length of the count. However, this approach increases costs. Therefore, there is a general desire to increase endurance of the memory by a certain factor, sufficient for most applications.
Just as an illustrative example, a count may be stored as a 32 bit or 4 byte word in a memory. In a straightforward approach to writing the count in the memory, every time the key is used 32 bits would be erased and written anew into the memory. However, for binary numerals, only the least significant bit toggles every time the count value is increased by one. Therefore, the position in the memory where the LSB of the 32 bit word is saved has the highest change or write burden. Thus, the bits with the higher write burden are exchanged periodically with bits having a lower write burden (more or most significant bits or MSBs). The bits that do not change are simply maintained. This saves write cycles of the memory in the locations where no change occurs. However, if the memory locations are exchanged, additional information is needed as to how and where the specific bits of the count are located after the change. Existing solutions add some additional bits to the number of bits necessary for the count. For example, if the count has 32 bits, then four additional bits may be used for indicating sixteen different configurations as to where the specific bits of the count are located after a change. However, this approach increases the size of the memory needed and thereby the costs of the respective products.